# -*- coding: utf-8 -*-

'''
Created on 8 nov. 2009

@author: vincent.vanghelle
'''
from django.db import models
from django.contrib.auth.models import User

from mmorganizer.games.models import Game
from mmorganizer.characters.models import Personnage,Roster
class CustomUserProfile(models.Model):
    user = models.OneToOneField(User, unique=True)
    game = models.ForeignKey(Game,null=True)
    defaultRoster = models.ForeignKey(Roster,null=True)
    defaultPersonnage = models.ForeignKey(Personnage, null=True)
    
    def __unicode__(self):
        return self.user.username + ' Profile'
    
    #@property
    def jeuxDisponibles(self):
        if not hasattr(self, '_jeuxDisponibles'):
            self._jeuxDisponibles = Game.objects.all()
        return self._jeuxDisponibles